package com.CloudDream.Item;

import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.List;


public class Dye {

    ItemStack ItemStack;
    private static short id;

    public ItemStack get() {
        return ItemStack;
    }

    public Dye(Material material, String Displayname, List<String> lore, Color color, boolean light) {
        if (color.equals(Color.BLACK)) {
            id = 0;
        }
        if (color.equals(Color.RED)) {
            id = 1;
        }
        if (color.equals(Color.OLIVE)) {
            id = 2;
        }
        if (color.equals(Color.MAROON)) {
            id = 3;
        }
        if (color.equals(Color.BLUE)) {
            id = 4;
        }
        if (color.equals(Color.PURPLE)) {
            id = 5;
        }
        if (color.equals(Color.NAVY)) {
            id = 6;
        }
        if (color.equals(Color.SILVER)) {
            id = 7;
        }
        if (color.equals(Color.GRAY)) {
            id = 8;
        }
        if (color.equals(Color.LIME)) {
            id = 10;
        }
        if (color.equals(Color.YELLOW)) {
            id = 11;
        }
        if (color.equals(Color.AQUA)) {
            id = 12;
        }
        if (color.equals(Color.FUCHSIA)) {
            id = 13;
        }
        if (color.equals(Color.ORANGE)) {
            id = 14;
        }
        if (color.equals(Color.WHITE)) {
            id = 15;
        }
        ItemStack Item = new ItemStack(material, 1, id);
        ItemMeta im = Item.getItemMeta();

        if (Displayname != null) {
            im.setDisplayName(Displayname);
        }
        if (lore != null) {
            im.setLore(lore);
        }
        if (light == true) {
            im.addEnchant(Enchantment.LUCK, 1, true);
            im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        }
        Item.setItemMeta(im);
        this.ItemStack = Item;
    }
}
